package org.codeart.apipassenger.controller;

import org.codeart.apipassenger.service.TokenService;
import org.codeart.common.util.R;
import org.codeart.common.response.TokenResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TokenController {
    
    @Autowired
    private TokenService tokenService;
    
    @PostMapping("/refresh-token")
    public R<TokenResponse> refreshToken(@RequestBody TokenResponse tokenResponse) {
        String refreshToken = tokenResponse.getRefreshToken();
        System.out.println(refreshToken);
        return tokenService.refreshToken(refreshToken);
    }

}
